package org.utils;

import java.util.Random;

/**
 * Some utils for testing.
 */
public class Utils {

    private static final Random RAND = new Random(System.currentTimeMillis());

    private Utils() {
    }

    /**
     * Retrieves random <code>long</code> number
     * from min to max.
     *
     * @param min from
     * @param max to
     * @return
     */
    public static long getRandom(long min, long max) {

        return Math.round(RAND.nextDouble() * (max - min) + min);
    }

    /**
     * Creates array of random numbers in range [0, 1000000]
     * with specified length.
     *
     * @param length length of array
     * @return generated array
     */
    public static int[] createRandomArray(int length) {

        int[] a = new int[length];

        for (int i = 0; i < a.length; i++) {
            a[i] = RAND.nextInt(1000000);
        }

        return a;
    }
}
